$(function () {

    var rowIndex = document.getElementById("curr-page").innerHTML;
    // alert(rowIndex);
    var url = "/beiying/article/getlist?rowIndex=" ;
    $('#prev').click(function () {
        if (rowIndex > 1){
            rowIndex = rowIndex-1;
            url = url + rowIndex;
            $('#preva').attr('href',url);
        }
        else {
            alert("已经是首页");
        }
    });
    $('#next').click(function () {
        if (rowIndex < 164){
            rowIndex = parseInt(rowIndex) + 1;
            url = url + rowIndex;
            $('#nexta').attr('href',url);
        }
        else {
            alert("已经是最后一页");
        }
    });
    $('#goTo').click(function () {
        rowIndex = $('#goToPage').val();
        if (rowIndex < 1 || rowIndex > 164){
            alert("没有此页的内容");
        }
        url = url + rowIndex;
        $('#gotoa').attr('href',url);
    });
    function dateToString(date){

        var date= new Date(Date.parse(date));
        var year = date.getFullYear();
        var month =(date.getMonth() + 1).toString();
        var day = (date.getDate()).toString();
        if (month.length === 1) {
            month = "0" + month;
        }
        if (day.length === 1) {
            day = "0" + day;
        }
        var dateTime = year + "-" + month + "-" + day;
        return dateTime;
    }
});